const Router = require('koa-router')
const AuthController = require('../controllers/auth.controller')
const jwt = require('../middlewares/jwt.middleware')

const router = new Router()
const authController = new AuthController()
router.prefix('/api/auth')

router.post('/signup', authController.signUp)

router.post('/signin', authController.signIn)

router.post('/signout', authController.signOut)

router.get('/', jwt, (ctx, next) => {
  ctx.response.body = ctx.state.user
  next()
})

module.exports = router